package com.iotek.bookstore.web.controlle;

import com.iotek.bookstore.modle.dao.impl.OrderDaoImpl;
import com.iotek.bookstore.modle.dao.impl.OrderDetailsDaoImpl;
import com.iotek.bookstore.modle.entity.OrderDetails;
import com.iotek.bookstore.modle.service.serviceimpl.OrderDetailsBizImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/login/orderDetails")
public class OrderDetailsServlet extends CommonServlet {
    @Override
    public void doInsert(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

    }

    @Override
    public void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

    }

    @Override
    public void doUpdate(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

    }

    @Override
    public void doQuery(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        Long orderId=Long.valueOf(req.getParameter("orderId"));
        List<OrderDetails>orderDetailsList=new OrderDetailsBizImpl().query(orderId);
        req.setAttribute("orderDetails",orderDetailsList);
        req.getRequestDispatcher("orderDetails.jsp").forward(req,resp);
    }
}
